<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function m(n){
				if(n>=0){
					var n1=n+"";
				alert(n1.substring(0,1));
				}else{
					alert("输入错误")
				}
			}
		</script>
	</head>
	<body>
		<input type="button" value="输入" onclick="m(prompt('请输入数字'))">
	</body>
</html>
